<template>
	<view>
		<view class="flex justify-between padding-sm bg-white">
			<view>
				{{ props.title }}
				<text class="margin-left-sm">{{ list.length }}</text>
			</view>
			<view @click="handleComment" class="cu-tag round padding-sm">
				<text class="cuIcon-command"></text>
				<text class="margin-left-sm">评论</text>
				<!-- <text class="">0</text>
				<text class="margin-left-sm cuIcon-appreciate"></text> -->
			</view>
		</view>
		<view class="cu-list menu-avatar comment solids-top">
			<view v-for="(item, index) in list" :key="index"  :data-value="item" @click="handleSelect" class="cu-item">
				<view class="cu-avatar round" :style="'background-image:url(' + item.avatarUrl + ');'"></view>
				<view class="content">
					<view class="text-grey">{{ item.accountName }}</view>
					<view class="text-gray text-content text-df">{{ item.content }}</view>
					<view class="margin-top-sm flex justify-start align-center">
						<view v-if="isreply" @click="handleShowReply" :data-value="item" class="cu-tag bg-grey light round margin-right-sm">
							<text>{{ item.replyNum }}</text>
							<text>回复</text>
							<text class="cuIcon-right text-gray "></text>
						</view>
						<view class="text-gray text-size-12">2022年12月1日</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup lang="ts">
import { useSettingStore } from '@/stores/index';
const setting = useSettingStore();
const emit = defineEmits(['action', 'reply','comment']);
const props = defineProps({
	isreply: {
		type: [Boolean, String],
		default: true
	},
	title: {
		type: String,
		default: '评论'
	},
	list: Array
});
const handleSelect = (e: any) => {
	emit('action', e.currentTarget.dataset.value);
};
const handleShowReply = (e: any) => {
	emit('reply', e.currentTarget.dataset.value);
};
const handleComment=(e:any)=>{
	emit('comment');
}
</script>

<style></style>
